rm(list = ls())
cat("\f")
options(scipen = 4)

library(synthdid)
source("simulation_functions.R")

B <- 200
Sim <- 500
resultK2 <- list()
resultK3 <- list()
resultK5 <- list()
resultCon <- list()

start <- 1
end <- Sim

T <- 10
N <- 50
resultK2$T10_N50 <- matrix(0,11,Sim)
resultK3$T10_N50 <- matrix(0,13,Sim)
for (i in start:end){
  resultK2$T10_N50[,i] <- simulationK2(T,N,B,1.85,0.63)
  resultK3$T10_N50[,i] <- simulationK3(T,N,B,1.85,0.63) 
}

T <- 20
N <- 50
resultK2$T20_N50 <- matrix(0,11,Sim)
resultK3$T20_N50 <- matrix(0,13,Sim)
for (i in start:end){
  resultK2$T20_N50[,i] <- simulationK2(T,N,B,1.85,0.63)
  resultK3$T20_N50[,i] <- simulationK3(T,N,B,1.85,0.63) 
}

T <- 30
N <- 50
resultK2$T30_N50 <- matrix(0,11,Sim)
resultK3$T30_N50 <- matrix(0,13,Sim)
for (i in start:end){
  resultK2$T30_N50[,i] <- simulationK2(T,N,B,1.85,0.63)
  resultK3$T30_N50[,i] <- simulationK3(T,N,B,1.85,0.63)
}

T <- 10
N <- 100
resultK2$T10_N100 <- matrix(0,11,Sim)
resultK3$T10_N100 <- matrix(0,13,Sim)
resultK5$T10_N100 <- matrix(0,11,Sim)
resultCon$T10_N100 <- matrix(0,11,Sim)
for (i in start:end){
  resultK2$T10_N100[,i] <- simulationK2(T,N,B,1.85,0.60)
  resultK3$T10_N100[,i] <- simulationK3(T,N,B,1.85,0.60)
  resultK5$T10_N100[,i] <- simulationK5(T,N,B,1.85,0.60)
  resultCon$T10_N100[,i] <- simulationCon(T,N,B,1.85,0.60)
}

T <- 20
N <- 100
resultK2$T20_N100 <- matrix(0,11,Sim)
resultK3$T20_N100 <- matrix(0,13,Sim)
resultK5$T20_N100 <- matrix(0,11,Sim)
resultCon$T20_N100 <- matrix(0,11,Sim)
for (i in start:end){
  resultK2$T20_N100[,i] <- simulationK2(T,N,B,1.85,0.60)
  resultK3$T20_N100[,i] <- simulationK3(T,N,B,1.85,0.60)
  resultK5$T20_N100[,i] <- simulationK5(T,N,B,1.85,0.60)
  resultCon$T20_N100[,i] <- simulationCon(T,N,B,1.85,0.60)
}

T <- 30
N <- 100
resultK2$T30_N100 <- matrix(0,11,Sim)
resultK3$T30_N100 <- matrix(0,13,Sim)
resultK5$T30_N100 <- matrix(0,11,Sim)
resultCon$T30_N100 <- matrix(0,11,Sim)
for (i in start:end){
  resultK2$T30_N100[,i] <- simulationK2(T,N,B,1.85,0.60)
  resultK3$T30_N100[,i] <- simulationK3(T,N,B,1.85,0.60)
  resultK5$T30_N100[,i] <- simulationK5(T,N,B,1.85,0.60)
  resultCon$T30_N100[,i] <- simulationCon(T,N,B,1.85,0.60)
}



print_sim(resultK2$T10_N50)
print_sim(resultK2$T20_N50)
print_sim(resultK2$T30_N50)
print_sim(resultK2$T10_N100)
print_sim(resultK2$T20_N100)
print_sim(resultK2$T30_N100)

print_sim(resultK3$T10_N50)
print_sim(resultK3$T20_N50)
print_sim(resultK3$T30_N50)
print_sim(resultK3$T10_N100)
print_sim(resultK3$T20_N100)
print_sim(resultK3$T30_N100)

print_sim(resultK5$T10_N100)
print_sim(resultK5$T20_N100)
print_sim(resultK5$T30_N100)

print_sim(resultCon$T10_N100)
print_sim(resultCon$T20_N100)
print_sim(resultCon$T30_N100)
